package org.example.leetcode.common._enum;

import org.bouncycastle.cms.PasswordRecipientId;

import java.util.HashMap;
import java.util.Map;

/**
 * @author topto
 */

public enum CodeLogStatusEnum implements BaseEnum<String,String>{
    /**
     * 待提交任务
     */
    DRAFT("0","待提交"),
    /**
     * 用例通过任务
     */
    SUCCESS("1","用例通过"),
    /**
     * 提交失败任务
     */
    FAIL("2","提交失败");
    public final String code;
    public final String name;
    private CodeLogStatusEnum(String code, String name){
        this.code=code;
        this.name=name;
    }
    @Override
    public String getCode() {
        return null;
    }

    @Override
    public String getName() {
        return null;
    }
    public static Map<String[],String> map=new HashMap<>();
    static {
        map.put(new String[]{CodeStatusEnum.success.getCode()},CodeLogStatusEnum.SUCCESS.code);
        map.put(new String[]{CodeStatusEnum.compile_error.getCode(),CodeStatusEnum.compile_error.getCode(),CodeStatusEnum.out_of_time.getCode()},CodeLogStatusEnum.FAIL.code);
    }
    public static String getLogStatusByCodeStatus(String codeStatus){
        for(Map.Entry<String[],String> entry:map.entrySet()){
            for(String s:entry.getKey()){
                if(s.equals(codeStatus)){
                    return entry.getValue();
                }
            }
        }
        return null;
    }
}
